cpuidle: add comments for hpet cpumask_lock usage
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 18 Jun 2010 13:09:44 +0000 (14:09 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 18 Jun 2010 13:09:44 +0000 (14:09 +0100)
Signed-off-by: Wei Gang <gang.wei@intel.com>
xen/arch/x86/hpet.c

index 25e4434cc1797584a742a2cf4e4c44797f781a68..4d9d5a1b61f952a2cf0f1961e0cbaf9eb025c1ac 100644 (file)
@@ -34,6 +34,17 @@ struct hpet_event_channel
     int           shift;
     s_time_t      next_event;
     cpumask_t     cpumask;
+    /*
+     * cpumask_lock is used to prevent hpet intr handler from accessing other
+     * cpu's timer_deadline_start/end after the other cpu's mask was cleared --
+     * mask cleared means cpu waken up, then accessing timer_deadline_xxx from
+     * other cpu is not safe.
+     * It is not used for protecting cpumask, so set ops needn't take it.
+     * Multiple cpus clear cpumask simultaneously is ok due to the atomic
+     * feature of cpu_clear, so hpet_broadcast_exit() can take read lock for 
+     * clearing cpumask, and handle_hpet_broadcast() have to take write lock 
+     * for read cpumask & access timer_deadline_xxx.
+     */
     rwlock_t      cpumask_lock;
     spinlock_t    lock;
     void          (*event_handler)(struct hpet_event_channel *);